﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ShareMarking.Systems.Entity;
using ShareMarking.Systems.Service;

namespace ShareMarking.Web.admin
{
    public partial class center : ManagePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                sys_manager admin_info = GetAdminInfo(); //管理员信息
                //登录信息
                if (admin_info != null)
                {
                    var model1 = sys_manager_logService.Instance.Get_Entitys_ByTop(1,sys_manager_log._.user_name == admin_info.user_name && sys_manager_log._.action_type ==  DTEnums.ActionEnum.Login.ToString(),null);
                    if (model1.Count >0)
                    {
                        //本次登录
                        litIP.Text = model1[0].user_ip;
                    }
                    var model2 = sys_manager_logService.Instance.Get_Entitys_ByTop(2, sys_manager_log._.user_name == admin_info.user_name && sys_manager_log._.action_type == DTEnums.ActionEnum.Login.ToString(), null);
                    if (model2.Count >1)
                    {
                        //上一次登录
                        litBackIP.Text = model2[1].user_ip;
                        litBackTime.Text = model2[1].add_time.ToString();
                    }
                }
                LitUpgrade.Text = "最新版本";//Utils.GetDomainStr(DTKeys.CACHE_OFFICIAL_UPGRADE, DESEncrypt.Decrypt(DTKeys.FILE_URL_UPGRADE_CODE, "DT"));
                LitNotice.Text = "暂无最新消息";// Utils.GetDomainStr(DTKeys.CACHE_OFFICIAL_NOTICE, DESEncrypt.Decrypt(DTKeys.FILE_URL_NOTICE_CODE, "DT"));
                //Utils.GetDomainStr("dt_cache_domain_info", "http://www.dtcms.net/upgrade.ashx?u=" + Request.Url.DnsSafeHost + "&i=" + Request.ServerVariables["LOCAL_ADDR"]);
            }
        }
    }
}